<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Module: ActiveSupport::CoreExtensions::String::Conversions</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Module</strong></td>
          <td class="class-name-in-header">ActiveSupport::CoreExtensions::String::Conversions</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../../files/vendor/rails/activesupport/lib/active_support/core_ext/string/conversions_rb.html">
                vendor/rails/activesupport/lib/active_support/core_ext/string/conversions.rb
                </a>
        <br />
            </td>
        </tr>

        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
Converting strings to other objects
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000700">ord</a>&nbsp;&nbsp;
      <a href="#M000702">to_date</a>&nbsp;&nbsp;
      <a href="#M000703">to_datetime</a>&nbsp;&nbsp;
      <a href="#M000701">to_time</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000700" class="method-detail">
        <a name="M000700"></a>

        <div class="method-heading">
          <a href="#M000700" class="method-signature">
          <span class="method-name">ord</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
&#8216;a&#8217;.<a href="Conversions.html#M000700">ord</a> ==
&#8216;a&#8217;[0] for Ruby 1.9 forward compatibility.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000700-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000700-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/string/conversions.rb, line 9</span>
 9:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ord</span>
10:           <span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span>]
11:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000702" class="method-detail">
        <a name="M000702"></a>

        <div class="method-heading">
          <a href="#M000702" class="method-signature">
          <span class="method-name">to_date</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000702-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000702-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/string/conversions.rb, line 18</span>
18:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_date</span>
19:           <span class="ruby-operator">::</span><span class="ruby-constant">Date</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">*</span><span class="ruby-operator">::</span><span class="ruby-constant">Date</span>.<span class="ruby-identifier">_parse</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-keyword kw">false</span>).<span class="ruby-identifier">values_at</span>(<span class="ruby-identifier">:year</span>, <span class="ruby-identifier">:mon</span>, <span class="ruby-identifier">:mday</span>))
20:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000703" class="method-detail">
        <a name="M000703"></a>

        <div class="method-heading">
          <a href="#M000703" class="method-signature">
          <span class="method-name">to_datetime</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000703-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000703-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/string/conversions.rb, line 22</span>
22:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_datetime</span>
23:           <span class="ruby-operator">::</span><span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-operator">*</span><span class="ruby-operator">::</span><span class="ruby-constant">Date</span>.<span class="ruby-identifier">_parse</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-keyword kw">false</span>).<span class="ruby-identifier">values_at</span>(<span class="ruby-identifier">:year</span>, <span class="ruby-identifier">:mon</span>, <span class="ruby-identifier">:mday</span>, <span class="ruby-identifier">:hour</span>, <span class="ruby-identifier">:min</span>, <span class="ruby-identifier">:sec</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span> <span class="ruby-identifier">arg</span> <span class="ruby-operator">||</span> <span class="ruby-value">0</span> })
24:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000701" class="method-detail">
        <a name="M000701"></a>

        <div class="method-heading">
          <a href="#M000701" class="method-signature">
          <span class="method-name">to_time</span><span class="method-args">(form = :utc)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Form can be either :utc (default) or :local.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000701-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000701-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/string/conversions.rb, line 14</span>
14:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_time</span>(<span class="ruby-identifier">form</span> = <span class="ruby-identifier">:utc</span>)
15:           <span class="ruby-operator">::</span><span class="ruby-constant">Time</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">&quot;#{form}_time&quot;</span>, <span class="ruby-operator">*</span><span class="ruby-operator">::</span><span class="ruby-constant">Date</span>.<span class="ruby-identifier">_parse</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-keyword kw">false</span>).<span class="ruby-identifier">values_at</span>(<span class="ruby-identifier">:year</span>, <span class="ruby-identifier">:mon</span>, <span class="ruby-identifier">:mday</span>, <span class="ruby-identifier">:hour</span>, <span class="ruby-identifier">:min</span>, <span class="ruby-identifier">:sec</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span> <span class="ruby-identifier">arg</span> <span class="ruby-operator">||</span> <span class="ruby-value">0</span> })
16:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>